﻿/*----------------------------------------------------------------
//  <copyright file="MySqlDapperSqlExecutor.cs" company="MicroCloud@151504200868">
//      Copyright © 2020-2024 MicroCloud Corporation, All rights reserved.
//  </copyright>
//  <site>https://gitee.com/chenmm123/microclouds</site>
//  <last-editor>cmm</last-editor>
//  <last-date>2023-11-21 10:54</last-date>
//----------------------------------------------------------------*/

namespace MicroCloud.Entity.MySql
{
    #region "MySql的Dapper-Sql功能执行"
    /// <summary>
    /// MySql的Dapper-Sql功能执行
    /// </summary>
    /// <typeparam name="TEntity">实体类型</typeparam>
    /// <typeparam name="TKey">编号类型</typeparam>
    public class MySqlDapperSqlExecutor<TEntity, TKey> : SqlExecutorBase<TEntity, TKey> where TEntity : IEntity<TKey>
    {
        #region "属性"
        #region "获取 数据库类型"
        /// <summary>
        /// 获取 数据库类型
        /// </summary>
        public override DatabaseType DatabaseType => DatabaseType.MySql;
        #endregion

        #endregion

        #region "构造函数"
        #region "初始化一个MySql的Dapper-Sql功能执行的新实例"
        /// <summary>
        /// 初始化一个MySql的Dapper-Sql功能执行 <see cref="MySqlDapperSqlExecutor{TEntity,TKey}"/> 的新实例
        /// </summary>
        /// <param name="provider">服务提供者</param>
        public MySqlDapperSqlExecutor(IServiceProvider provider)
            : base(provider)
        { }
        #endregion

        #endregion

        #region "方法"
        #region "重写以获取数据连接对象"
        /// <summary>
        /// 重写以获取数据连接对象
        /// </summary>
        /// <param name="connectionString">数据连接字符串</param>
        /// <returns></returns>
        protected override IDbConnection GetDbConnection(string connectionString)
        {
            return new MySqlConnection(connectionString);
        }
        #endregion

        #endregion

    }
    #endregion

}
